package com.stake.entity;

import java.io.Serializable;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Unique;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Questions implements Serializable {
	
	enum QuestionType {
		TEXT, SELECT_ONE, MULTI_SELECT, RADIO;
		
		public String getName(){
			return name();
		}
	}

	private static final long serialVersionUID = 1L;
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
	@Unique
	@Persistent
	private Long id;
	@Persistent
	private String questionDesc;
	@Persistent
	private QuestionType questionType;
	@Persistent
	private String questionTypeName;
	@Persistent
	private List<String> selectOptions;
	
	@Persistent
	private Boolean nonLinkedInUser;
	
	
	
	/**
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}
	/**
	 * @param key the key to set
	 */
	public void setKey(Key key) {
		this.key = key;
	}
	
	/**
	 * @return the questionDesc
	 */
	public String getQuestionDesc() {
		return questionDesc;
	}
	/**
	 * @param questionDesc the questionDesc to set
	 */
	public void setQuestionDesc(String questionDesc) {
		this.questionDesc = questionDesc;
	}
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return the questionType
	 */
	public QuestionType getQuestionType() {
		if(questionType != null){
			return QuestionType.valueOf(QuestionType.class, questionTypeName);
		}
		return questionType;
	}
	/**
	 * @param questionType the questionType to set
	 */
	public void setQuestionType(QuestionType questionType) {
		this.questionType = questionType;
	}
	/**
	 * @return the selectOptions
	 */
	public List<String> getSelectOptions() {
		return selectOptions;
	}
	/**
	 * @param selectOptions the selectOptions to set
	 */
	public void setSelectOptions(List<String> selectOptions) {
		this.selectOptions = selectOptions;
	}
	/**
	 * @return the questionTypeName
	 */
	public String getQuestionTypeName() {
		return questionTypeName;
	}
	/**
	 * @param questionTypeName the questionTypeName to set
	 */
	public void setQuestionTypeName(String questionTypeName) {
		this.questionTypeName = questionTypeName;
	}
	/**
	 * @return the nonLinkedInUser
	 */
	public Boolean getNonLinkedInUser() {
		return nonLinkedInUser;
	}
	/**
	 * @param nonLinkedInUser the nonLinkedInUser to set
	 */
	public void setNonLinkedInUser(Boolean nonLinkedInUser) {
		this.nonLinkedInUser = nonLinkedInUser;
	}
	
}
